﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Shop.Model.Entity.Use;

namespace Shop.Model.Entity.Order
{
    /// <summary>
    /// 订单
    /// </summary>
    [SugarTable("ord_orders")]
    public class Orders : BaseEntity
    {
        /// <summary>
        /// 
        /// </summary>
        public Orders()
        {
        }

        /// <summary>
        /// 订单编号
        /// </summary>
        public string Code { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public long UserId { get; set; }

        /// <summary>
        /// 收货人姓名
        /// </summary>
        public string ConsigneeName { get; set; }

        /// <summary>
        /// 收货人电话
        /// </summary>
        public string ConsigneePhone { get; set; }

        /// <summary>
        /// 收货省
        /// </summary>
        public string ConsigneeProvince { get; set; }

        /// <summary>
        /// 收货市
        /// </summary>
        public string ConsigneeCity { get; set; }

        /// <summary>
        /// 收货区县
        /// </summary>
        public string ConsigneeDistrict { get; set; }

        /// <summary>
        /// 乡/镇
        /// </summary>
        public string ConsigneeTown { get; set; }

        /// <summary>
        /// 收货地址
        /// </summary>
        public string ConsigneeAddress { get; set; }

        /// <summary>
        /// 卖家备注
        /// </summary>
        public string Note { get; set; }

        /// <summary>
        /// 商品总价
        /// </summary>
        public decimal GoodsAmount { get; set; }

        /// <summary>
        /// 物流费用
        /// </summary>
        public decimal LogisticsFee { get; set; }

        /// <summary>
        /// 优惠金额
        /// </summary>
        public decimal DiscountAmount { get; set; }

        /// <summary>
        /// 订单金额
        /// </summary>
        public decimal OrderAmount { get; set; }

        /// <summary>
        /// 支付渠道 1：钱包 2：微信 3：线下
        /// </summary>
        public int PayChannel { get; set; }

        /// <summary>
        /// 交易订单号
        /// </summary>
        public string TransactionId { get; set; }

        /// <summary>
        /// 订单状态
        /// </summary>
        public int OrderStatus { get; set; }

        /// <summary>
        /// 订单类型
        /// 1：普通
        /// 2：升级
        /// </summary>
        public int OrderType { get; set; }

        /// <summary>
        /// 是否返佣
        /// </summary>
        public bool IsBrokerage { get; set; } = true;

        /// <summary>
        /// 创建时间
        /// </summary>
        [SugarColumn(IsOnlyIgnoreInsert = true)]
        public DateTime CreateTime { get; set; }

        /// <summary>
        /// 支付时间
        /// </summary>
        public DateTime? PayTime { get; set; }  

        /// <summary>
        /// 发货时间
        /// </summary>
        public DateTime? DeliveryTime { get; set; }

        /// <summary>
        /// 收货时间时间
        /// </summary>
        public DateTime? ReceiveTime { get; set; }

        /// <summary>
        /// 订单关闭时间
        /// </summary>
        public DateTime? CloseTime { get; set; }

        /// <summary>
        /// 订单商品
        /// </summary>
        [Navigate(NavigateType.OneToMany, nameof(OrdersGoods.OrdersId))]
        public List<OrdersGoods> Goods { get; set; }

        /// <summary>
        /// 单量积分
        /// </summary>
        public int Point { get; set; }

        /// <summary>
        /// 是否后台添加
        /// </summary>
        public bool IsAdmin { get; set; } = false;
        
        /// <summary>
        /// 后台创建时间
        /// </summary>
        public DateTime? AdminTime { get; set; }
        
        /// <summary>
        /// 管理账号
        /// </summary>
        public long AdminId { get; set; }
        
        /// <summary>
        /// 是否个人账号收款
        /// </summary>
        public bool IsNom { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public long V3 { get; set; }
    }
}
